<body>
  <script>
    window.onportalactivate = e => {
      var portal = e.adoptPredecessor();
      document.body.appendChild(portal);
    }
  </script>
</body>
